package com.lzj.demo.collection.set;

import java.util.TreeSet;

public class SetDemo {
    public static void main(String[] args) {
        TreeSet<Student> ts = new TreeSet<Student>();
        Student s1 = new Student("linzejian",20);
        Student s2 = new Student("linzejun" ,24);
        Student s3 = new Student("zhengguoxiang",20);
        Student s4 = new Student("liuzhengdong",26);
        Student s5 = new Student("nitao",21);
    ts.add(s1);
    ts.add(s2);
    ts.add(s3);
    ts.add(s4);
    ts.add(s5);
    for(Student s: ts){
        System.out.println(s.getName()+","+s.getAge());

    }
    }
}
